package com.peter.data.mapstruct;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import com.peter.data.dto.IdeaDTO;
import com.peter.data.entity.Idea;

@Mapper
public interface IdeaMapStruct {
    @Mappings(value = {
            @Mapping(source = "idea.id", target = "id"),
            @Mapping(target = "tags", expression = "idea.tags.stream()"
                    + ".map(com.peter.data.entity.IdeaTag::getName)"
                    + ".collect(java.util.stream.Collectors.toList())")
    })
    IdeaDTO to(Idea idea);
//    Idea from(IdeaDTO ideaDTO);
}
